﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using BLL;
using BLL.Interfaces;
using DAL;
using POCOS;

namespace GUI.Filters
{
    
    public class LogAttribute : ActionFilterAttribute
    {
       
        AuteurContext db = new AuteurContext();


        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
                 Log("OnActionExecuted", filterContext.RouteData);
                
             
                
        }
        private void Log(string methodName, RouteData routeData)
        {
            ActionLogs lg = new ActionLogs();
            lg.Controller = routeData.Values["controller"].ToString();
            lg.ActionName = routeData.Values["action"].ToString();
            lg.Ip = "Ip adress";
            db.Logs.Add(lg);
            db.SaveChanges();

           
           
        }

      




    }
}